﻿using INTEX.DataBase;
using ReflectionStudio.Components.UserControls;
using ReflectionStudio.Core.Events;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.OracleClient;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using ReflectionStudio.Core.Helpers;
using System.Xml;
using System.Linq;
using WPFExcelReport.Helpers;
namespace WPFExcelReport
{
    /// <summary>
    /// Interaction logic for ProductionOrder.xaml
    /// </summary>
    public partial class YCAABAPP : DocumentBase
    {
        #region-------------Properties-----------------------
        DataRow LastRow = null;
        public OracleConnection OracleDB;
        public OracleCommand orlReadCommand = new OracleCommand();
        public IntexReptServBLClient proxy;
        private Dictionary<string, object> dicParamater;
        public DataSet dsResult;
        YCAABAPPData m_Data, m_DataX;
        public DataSet dsParamaters;
        YCAABAPPReport m_rpt;
        DataTable tbUser = null;
        public SETINTEXDB SetData
        {
            get
            {
                return (SETINTEXDB)TryFindResource("SetData");
            }
        }
        public SETINTEXDB SetProd
        {
            get
            {
                return (SETINTEXDB)TryFindResource("SetProd");
            }
        }
        CollectionViewSource vwABPOS_MAT
        {
            get
            {
                return (CollectionViewSource)this.TryFindResource("vwABPOS_MAT");
            }
        }
        CollectionViewSource vwYARNMatrix
        {
            get
            {
                return (CollectionViewSource)this.TryFindResource("vwYARNMatrix");
            }
        }
        CollectionViewSource vwFABMatrix
        {
            get
            {
                return (CollectionViewSource)this.TryFindResource("vwFABMatrix");
            }
        }
        CollectionViewSource vwMATMatrix
        {
            get
            {
                return (CollectionViewSource)this.TryFindResource("vwMATMatrix");
            }
        }

        CollectionViewSource vwABPOS
        {
            get
            {
                return (CollectionViewSource)this.TryFindResource("vwABPOS");
            }
        }
        DataRow dwABPOS
        {
            get
            {
                if (vwABPOS.View == null)
                    return null;
                if ((DataRowView)vwABPOS.View.CurrentItem == null)
                    return null;
                return ((DataRowView)vwABPOS.View.CurrentItem).Row;
            }
        }
        CollectionViewSource vwABKOPF
        {
            get
            {
                return (CollectionViewSource)this.TryFindResource("vwABKOPF");
            }
        }
        DataRow dwABKOPF
        {
            get
            {
                if (vwABKOPF.View == null)
                    return null;
                if ((DataRowView)vwABKOPF.View.CurrentItem == null)
                    return null;
                return ((DataRowView)vwABKOPF.View.CurrentItem).Row;
            }
        }
        CollectionViewSource vwLIEFDAT
        {
            get
            {
                return (CollectionViewSource)this.TryFindResource("vwLIEFDAT");
            }
        }
        DataRow dwLIEFDAT
        {
            get
            {
                if (vwLIEFDAT.View == null)
                    return null;
                if ((DataRowView)vwLIEFDAT.View.CurrentItem == null)
                    return null;
                return ((DataRowView)vwLIEFDAT.View.CurrentItem).Row;
            }
        }
        public bool IsStartApp
        {
            get
            {
                if (IsStartApproval.IsChecked == true)
                    return true;
                return false;
            }
            set
            {
                IsStartApproval.IsChecked = value;
            }
        }
        BindingListCollectionView cvXDECK
        {
            get
            {
                return (BindingListCollectionView)CollectionViewSource.GetDefaultView(dlgAB04.ItemsSource);
            }
        }
        string ART
        {
            get
            {
                return m_Data.Left(txtFSART.Text.ToString() + "                      ", 20);
            }
        }
        
        string user = "";
        #endregion
        public YCAABAPP()
        {
            InitializeComponent();
            this.Name = "生产审核";
        }
        public override void SetUp(Dictionary<string, object> dicParamater)
        {
            dicParamater["blBuildCellMastrix"] = false;
            base.SetUp(dicParamater);
            InitializeComponent();
            this.dicParamater = dicParamater;
            OracleDB = (OracleConnection)dicParamater["OracleDB"];
            proxy = (IntexReptServBLClient)dicParamater["proxy"];
            tbUser = (DataTable)dicParamater["USERRIGHT"];
            m_Data = new YCAABAPPData(OracleDB, proxy);
            user = (string)dicParamater["User"];
            txtFSART.Text = "23401090091";  
        }
      
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                vwABKOPF.View.CurrentChanged += vwABKOPF_CurrentChanged;
                cbWTYE.Text = "成衣款式";
                SetData.Merge(m_Data.LoadAssData());
            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
            return;

        }
        void BuildData()
        {
            SetProd.Clear();
            using (new LongOperation(this, "数据更新中"))
            {
                if (dwABKOPF == null)
                    return;
                DataSet SResult = m_Data.BuildData(dwABKOPF);
                SetProd.Merge(SResult);
            }
        }

        void ResetData()
        {
            using (new LongOperation(this, "数据更新中"))
            {

                DataSet SResult = m_Data.ResetData(SetProd);
                SetProd.Clear();
                SetProd.Merge(SResult);
            }
        }
        void vwABKOPF_CurrentChanged(object sender, EventArgs e)
        {
            try
            {
                if (dwABKOPF == null)
                    return;
                if (LastRow == dwABKOPF)
                    return;
                LastRow = dwABKOPF;
                return;
                BuildData();
                ResetData();

            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
        }

        private void cbFSART_SelecteionChanged(object sender, SelectionChangedEventArgs e)
        {
            DataRowView drv = null;
            ItemsControl sd;
            ICollectionView view;
            try
            {
                sd = sender as ItemsControl;
                view = CollectionViewSource.GetDefaultView(sd.ItemsSource);
                if (e.AddedItems.Count > 0)
                {
                    drv = e.AddedItems[0] as DataRowView;
                    txtFSART.Text = drv["FSART"].ToString();
                }
            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
        }

        private void btnQuery_Click(object sender, EventArgs e)
        {
            try
            {//FSMANDANT	FSART	FSVAR
                DataRow dwInput = null;
                switch (cbWTYE.Text)
                {
                    case "成衣款式":
                        dwInput = SetProd.FDECK.NewRow();
                        dwInput["FDMANDANT"] = "00";
                        dwInput["FDART"] = ART;
                        dwInput["FDTYP"] = "Z";
                        break;
                    case "面料":
                        dwInput = SetProd.WDECK.NewRow();
                        dwInput["WDMANDANT"] = "00";
                        dwInput["WDART"] = ART;
                        dwInput["WDTYP"] = "B";
                        break;
                    case "辅料":
                        dwInput = SetProd.MDECK.NewRow();
                        dwInput["MDMANDANT"] = "00";
                        dwInput["MDMAT"] = m_Data.Left(ART + "            ", 14);
                        dwInput["MDTYP"] = "B";
                        break;
                    case "高级辅料":
                        dwInput = SetProd.FDECK.NewRow();
                        dwInput["FDMANDANT"] = "00";
                        dwInput["FDART"] = ART;
                        dwInput["FDTYP"] = "B";
                        break;
                }

                DataSet SResult = new DataSet();
                using (new LongOperation(this, "数据更新中"))
                {
                    SResult = m_Data.GetData(dwInput);
                }

                SetData.ICC_ABKOPF.Clear();
                if (SResult.Tables.Contains("ICC_ABKOPF"))
                {
                    SetData.Merge(SResult.Tables["ICC_ABKOPF"]);
                }
                SetProd.Clear();
                SetProd.Merge(SResult);
                ResetData();
            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
        }

        private void btnPrint_Click(object sender, EventArgs e)
        {

            DataSet setRpt = new DataSet();

            if (setRpt == null)
                return;
            m_DataX = new YCAABAPPData(dicParamater);
            m_DataX.OracleDB = this.OracleDB;
            m_DataX.proxy = this.proxy;
            if (m_DataX.exAgent._app == null)
            {
                m_DataX.exAgent = new ExcelX.ExcelLib.ExcelAgent(dicParamater);
            }
            m_rpt = new YCAABAPPReport(dicParamater);
            m_rpt.dsSource = SetProd;
            m_rpt.exAgent = m_DataX.exAgent;
            m_rpt.WriteExcelReport("EXCEL");
        }

        private void MasterDataGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            try
            {
                if (e.EditAction != DataGridEditAction.Commit)
                    return;
                DataGridColumn cell = e.Column;

                DataGridRow row = e.Row;
                string size = cell.Header.ToString();
                string mat = ((DataRowView)row.Item)["ABPART"].ToString();
                string var = ((DataRowView)row.Item)["ABPVAR"].ToString();
                string color = ((DataRowView)row.Item)["ABPFARBE"].ToString();
                TextBox t = e.EditingElement as TextBox;  // Assumes columns are all TextBoxes
                decimal newqty = 100 * System.Convert.ToDecimal(t.Text.ToString());//新的总和

                var query = from DataRow rowx in SetProd.Tables["ABPOS"].AsEnumerable()
                            where rowx["ABPFARBE"].ToString().Trim() == color.Trim()
                            && rowx["ABPGROE"].ToString().Trim() == size.Trim()
                            select rowx;
                foreach (DataRow rowx in query)
                {
                    rowx["ABPSOLLMENGE7"] = newqty;
                }
                ResetData();
            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
        }

        private void MDECKDataGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            try
            {

                if (e.EditAction != DataGridEditAction.Commit)
                    return;
                DataGridColumn cell = e.Column;
                DataGridRow row = e.Row;
                string field = cell.Header.ToString();
                string mat = ((DataRowView)row.Item)["ART"].ToString();
                string var = ((DataRowView)row.Item)["VAR"].ToString();

                string szQty = ((DataRowView)row.Item)["TQTY"].ToString();
                if (szQty.Trim() == "")
                    szQty = "0";
                decimal pQTY = System.Convert.ToDecimal(szQty);//总和
                TextBox t = e.EditingElement as TextBox;  // Assumes columns are all TextBoxes
                decimal nQty = System.Convert.ToDecimal(t.Text.ToString());//新的总和
                //Debug.WriteLine(t.Text .ToString());
                DataTable tbMDECK = SetData.MDECK;
                var query = from DataRow rm in tbMDECK.AsEnumerable()
                            where rm["MDMAT"].ToString().Trim() == mat.Trim()
                            && rm["MDVAR"].ToString().Trim() == var.Trim()
                            select rm;
                foreach (DataRow rm in query)
                {
                    decimal pSKU = System.Convert.ToDecimal(rm["MDMENGE"].ToString());
                    var qab = from DataRow rab in SetProd.Tables["ABPOS"].AsEnumerable()
                              where
                              rab["ABPAUFKRS"].ToString() == rm["MDAUFKRS"].ToString()
                              && rab["ABPAUFLFD"].ToString() == rm["MDAUFLFD"].ToString()
                              && rab["ABPAUFPOS"].ToString() == rm["MDAUFPOS"].ToString()
                              select rab;
                    foreach (DataRow rab in qab)
                    {
                        decimal qsku = System.Convert.ToDecimal(rab["ABPSOLLMENGE7"].ToString());
                        if (qsku == 0)
                            continue;
                        if (pSKU > 0 && pQTY > 0)
                        {
                            decimal qR = pSKU / pQTY;
                            decimal rate = System.Convert.ToDecimal(rm["RATIO"].ToString());
                            decimal nq = nQty * qR / rate;
                            rab["ABPSOLLMENGE7"] = 100 * System.Math.Round(nq * System.Convert.ToDecimal(0.01), 0);
                            rm["MDMENGE"] = nQty * qR;
                        }
                        /*
                         SKU用量 pSKU
                         占总量比例 qR=pSKU/pQTY
                         新的用量=nQty*qR
                         新的总件数=nQty/pQty
                         */
                    }
                }

            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
            finally
            {
                //ResetData();
            }
        }

        private void WDECKDataGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            try
            {

                if (e.EditAction != DataGridEditAction.Commit)
                    return;
                DataGridColumn cell = e.Column;
                DataGridRow row = e.Row;
                string field = cell.Header.ToString();
                string mat = ((DataRowView)row.Item)["ART"].ToString();
                string var = ((DataRowView)row.Item)["VAR"].ToString();
                string color = ((DataRowView)row.Item)["FARBE"].ToString();

                string szQty = ((DataRowView)row.Item)["TQTY"].ToString();
                if (szQty.Trim() == "")
                    szQty = "0";
                decimal pQTY = System.Convert.ToDecimal(szQty);//总和
                TextBox t = e.EditingElement as TextBox;  // Assumes columns are all TextBoxes
                decimal nQty = 100 * System.Convert.ToDecimal(t.Text.ToString());//新的总和
                //Debug.WriteLine(t.Text .ToString());
                DataTable tbWDECK = SetProd.WDECK;
                var query = from DataRow rm in tbWDECK.AsEnumerable()
                            where rm["WDART"].ToString().Trim() == mat.Trim()
                            && rm["WDVAR"].ToString().Trim() == var.Trim()
                            && rm["WDFARBE"].ToString().Trim() == color.Trim()
                            select rm;
                foreach (DataRow rm in query)
                {
                    decimal pSKU = System.Convert.ToDecimal(rm["WDBEDARF"].ToString());
                    var qab = from DataRow rab in SetProd.Tables["ABPOS"].AsEnumerable()
                              where
                              rab["ABPAUFKRS"].ToString() == rm["WDAUFKRS"].ToString()
                              && rab["ABPAUFLFD"].ToString() == rm["WDAUFLFD"].ToString()
                              && rab["ABPAUFPOS"].ToString() == rm["WDAUFPOS"].ToString()
                              select rab;
                    foreach (DataRow rab in qab)
                    {
                        decimal qsku = System.Convert.ToDecimal(rab["ABPSOLLMENGE7"].ToString());
                        if (qsku == 0)
                            continue;
                        if (pSKU > 0 && pQTY > 0)
                        {
                            decimal qR = pSKU / pQTY;
                            decimal rate = System.Convert.ToDecimal(rm["RATIO"].ToString());
                            decimal nq = nQty * qR / rate;
                            rab["ABPSOLLMENGE7"] = 100 * System.Math.Round(nq * System.Convert.ToDecimal(0.01), 0);
                            rm["WDBEDARF"] = nQty * qR;
                        }
                        /*
                         SKU用量 pSKU
                         占总量比例 qR=pSKU/pQTY
                         新的用量=nQty*qR
                         新的总件数=nQty/pQty
                         */
                    }
                }

            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
            finally
            {

                //ResetData();
            }
        }

        private void FDECKDataGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            try
            {

                if (e.EditAction != DataGridEditAction.Commit)
                    return;
                DataGridColumn cell = e.Column;
                DataGridRow row = e.Row;
                string field = cell.Header.ToString();
                string mat = ((DataRowView)row.Item)["ART"].ToString();
                string var = ((DataRowView)row.Item)["VAR"].ToString();
                string color = ((DataRowView)row.Item)["FARBE"].ToString();
                string size = ((DataRowView)row.Item)["SIZE"].ToString();

                string szQty = ((DataRowView)row.Item)["TQTY"].ToString();
                if (szQty.Trim() == "")
                    szQty = "0";
                decimal pQTY = System.Convert.ToDecimal(szQty);//总和
                TextBox t = e.EditingElement as TextBox;  // Assumes columns are all TextBoxes
                decimal nQty = System.Convert.ToDecimal(t.Text.ToString());//新的总和
                //Debug.WriteLine(t.Text .ToString());
                DataTable tbFDECK = SetProd.FDECK;
                var query = from DataRow rm in tbFDECK.AsEnumerable()
                            where rm["FDART"].ToString().Trim() == mat.Trim()
                            && rm["FDVAR"].ToString().Trim() == var.Trim()
                            && rm["FDFARBE"].ToString().Trim() == color.Trim()
                            && rm["FDGROE"].ToString().Trim() == size.Trim()
                            select rm;
                foreach (DataRow rm in query)
                {
                    decimal pSKU = System.Convert.ToDecimal(rm["FDMENGE"].ToString());
                    var qab = from DataRow rab in SetProd.Tables["ABPOS"].AsEnumerable()
                              where
                              rab["ABPAUFKRS"].ToString() == rm["FDAUFKRS"].ToString()
                              && rab["ABPAUFLFD"].ToString() == rm["FDAUFLFD"].ToString()
                              && rab["ABPAUFPOS"].ToString() == rm["FDAUFPOS"].ToString()
                              select rab;
                    foreach (DataRow rab in qab)
                    {
                        decimal qsku = System.Convert.ToDecimal(rab["ABPSOLLMENGE7"].ToString());
                        if (qsku == 0)
                            continue;
                        if (pSKU > 0 && pQTY > 0)
                        {
                            decimal qR = pSKU / pQTY;
                            decimal rate = System.Convert.ToDecimal(rm["RATIO"].ToString());
                            decimal nq = nQty * qR / rate;
                            rab["ABPSOLLMENGE7"] = 100 * System.Math.Round(nq * System.Convert.ToDecimal(0.01), 0);
                            rm["FDMENGE"] = nQty * qR;
                        }
                        /*
                         SKU用量 pSKU
                         占总量比例 qR=pSKU/pQTY
                         新的用量=nQty*qR
                         新的总件数=nQty/pQty
                         */
                    }
                }

            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
            finally
            {

                //ResetData();
            }
        }

        private void btnRefresh_Click(object sender, RoutedEventArgs e)
        {
            ResetData();
        }

        private void btnGetTask_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                cvXDECK.CustomFilter = null;
                DataRow row = SetData.ABPOS.NewABPOSRow();
                string status = cmbStatus.Text.ToString().Trim();
                if (status == "") status = "89";
                if (status == "RUN") status = "  ";
                if (status == "*") status = "*";
                row["ABPMANDANT"] = "00";
                row["ABPSPGRD"] = status;
                using (new LongOperation(this, "数据更新中"))
                {
                    DataSet SResult = m_Data.GetTask(row);
                    SetData.ICC_ABKOPF.Clear();
                    if (SResult.Tables.Contains("ICC_ABKOPF"))
                    {
                        SetData.Merge(SResult.Tables["ICC_ABKOPF"]);
                    }
                }
            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
        } 
        private void btnUpdateIntex_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                txtMessage.Text = "";
                if (dwLIEFDAT == null)
                    return;
                string liefnr = dwLIEFDAT["LSLIEFNR"].ToString();
                string LSLIEFNA = dwLIEFDAT["LSLIEFNA"].ToString();
                string ks = Helper.Left(dwLIEFDAT["LSLIEFNA"].ToString(), 2);
                DataRow dwKS05;
                bool IsFound = false;
                dwKS05 = SetData.KSTAGZUO.NewRow();
                dwKS05["KSZMANDANT"] = dwLIEFDAT["LSMANDANT"].ToString();
                dwKS05["KSZLIEFNR"] = dwLIEFDAT["LSLIEFNR"].ToString();
                DataSet SResult = m_Data.INTEXDBC.QueryKSTAGZUO(dwKS05, 1);
                if (SResult.Tables.Count > 0)
                {
                    foreach (DataRow row in SResult.Tables[0].Rows)
                    {
                        dwKS05 = row;
                        IsFound = true;
                    }
                }
                DataRow dwTemp = SetData.ABPOS.NewRow();
                dwTemp["ABPMANDANT"] = dwABKOPF["ABKMANDANT"];
                dwTemp["ABPAUFKRS"] = dwABKOPF["ABKAUFKRS"];
                dwTemp["ABPAUFLFD"] = dwABKOPF["ABKAUFLFD"];
                dwTemp["ABPLIEFDAT"] = dwABKOPF["ABKLIEFDAT"];
                dwTemp["ABPENDDAT"] = dwABKOPF["ABKLIEFDAT"];
                dwTemp["ABPENDDATA"] = dwABKOPF["ABKLIEFDAT"];
                dwTemp["ABPLIEFDATN"] = dwABKOPF["ABKLIEFDAT"];
                //ABPLIEFDAT,ABPENDDAT,ABPENDDATA,ABPLIEFDATN
                dwTemp["ABPLIEFNR"] = liefnr;
                dwTemp["ABPANRKR"] = ks;
                if (IsFound)
                {
                    dwTemp["ABPZLO"] = dwKS05["KSZLO"];
                    dwTemp["ABPZLB"] = dwKS05["KSZLB"];
                }
                else
                {
                    dwTemp["ABPZLO"] = "01";
                    dwTemp["ABPZLB"] = "  ";
                }
                m_Data.INTEXDBC.UpdateABPOS(dwTemp, 2);


                dwTemp = SetData.ABFOLGE.NewRow();
                dwTemp["ABFMANDANT"] = dwABKOPF["ABKMANDANT"];
                dwTemp["ABFAUFKRS"] = dwABKOPF["ABKAUFKRS"];
                dwTemp["ABFAUFLFD"] = dwABKOPF["ABKAUFLFD"];
                dwTemp["ABFLIEFNR"] = liefnr;
                dwTemp["ABFBNRKRS"] = ks;
                dwTemp["ABFKSTKRS"] = ks;
                dwTemp["ABFSOLLDAT"] = dwABKOPF["ABKLIEFDAT"];
                dwTemp["ABFSOLLDATA"] = dwABKOPF["ABKLIEFDAT"];

                if (IsFound)
                {
                    dwTemp["ABFLO"] = dwKS05["KSZLO"];
                    dwTemp["ABFLB"] = dwKS05["KSZLB"];
                    dwTemp["ABFLP"] = dwKS05["KSZLP"];
                }
                else
                {
                    dwTemp["ABFLO"] = "01";
                    dwTemp["ABFLB"] = "  ";
                    dwTemp["ABFLP"] = "        ";
                }
                m_Data.INTEXDBC.UpdateABFOLGE(dwTemp, 2);
                txtMessage.Text = dwABKOPF["ABKAUFKRS"].ToString() + "-" + dwABKOPF["ABKAUFLFD"].ToString() + ":" + dwABKOPF["ABPART"].ToString().Trim() + "已经修改!";
            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
                txtMessage.Text = ex.Message;
            }
        }
        private void btnApprove_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                txtMessage.Text = "";
                if (dwABKOPF == null)
                    return;
                if (!IsStartApp)
                    return;
                string status = dwABKOPF["ABKSPGRD"].ToString();
                if (status != "89")
                {
                    txtMessage.Text = "主面料尚未批复";
                    MessageBox.Show("主面料尚未批复");
                }
                DataRow dwABPOS = m_Data.INTEXDB.ABPOS.NewRow();
                dwABPOS["ABPMANDANT"] = "00";
                dwABPOS["ABPAUFKRS"] = dwABKOPF["ABKAUFKRS"];
                dwABPOS["ABPAUFLFD"] = dwABKOPF["ABKAUFLFD"];
                dwABPOS["ABPSPGRD"] = "  ";
                dwABPOS["ABPGESSTA"] = "TE";
                m_Data.INTEXDBC.UpdateABPOS(dwABPOS, 3);
                txtMessage.Text = dwABKOPF["ABKAUFKRS"].ToString() + "-" + dwABKOPF["ABKAUFLFD"].ToString() + ":" + dwABKOPF["ABPART"].ToString() + "已经审核!";
            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
                txtMessage.Text = ex.Message;
            }
        }

        private void IsStartApproval_Checked(object sender, RoutedEventArgs e)
        {
            cvXDECK.CustomFilter = "ABKSPGRD='89'";
        }
    }
}
